<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
const patients = [
  {
    id: '001',
    name: 'Alice',
    age: 34,
    gender: 'F',
    bloodPressure: {
      systolic: 120,
      diastolic: 80
    },
    hasDiabetes: false
  },
  {
    id: '002',
    name: 'Bob',
    age: 47,
    gender: 'M',
    bloodPressure: {
      systolic: 140,
      diastolic: 90
    },
    hasDiabetes: true
  },
  {
    id: '003',
    name: 'Charlie',
    age: 55,
    gender: 'M',
    bloodPressure: {
      systolic: 130,
      diastolic: 95
    },
    hasDiabetes: false
  }
];

function getHighBloodPressurePatients(patients, systolicThreshold, diastolicThreshold){
    const p =  patients.filter((item)=>{
      if(item.bloodPressure.systolic>=systolicThreshold || item.bloodPressure.diastolic>=diastolicThreshold){
        return item
      }
    })
   const sortname =  p.sort((a,b)=>{
    const nameA = a.name.toUpperCase()
    const nameB = b.name.toUpperCase()
    return nameB - nameA
   })
   return sortname
}
const res = getHighBloodPressurePatients(patients,140,90)
console.log(res)

const items = [
  { name: "Edward", value: 21 },
  { name: "Sharpe", value: 37 },
  { name: "And", value: 45 },
  { name: "The", value: -12 },
  { name: "Magnetic", value: 13 },
  { name: "Zeros", value: 37 },
];
// 根据 name 排序
items.sort((a, b) => {
  const nameA = a.name.toUpperCase(); // 忽略大小写
  const nameB = b.name.toUpperCase(); // 忽略大小写
  if (nameA < nameB) {
    return -1;
  }
  if (nameA > nameB) {
    return 1;
  }

  // name 必须相等
  return 0;
});
    </script>
</body>
</html>